//
//  AlertController.m
//  InSuger
//
//  Created by dllo on 15/11/30.
//  Copyright © 2015年 Dior_3g. All rights reserved.
//

#import "AlertController.h"

@implementation AlertController

+ (void)createAlertTitle:(NSString *)alertTitle alertMessage:(NSString *)alertMessage cancelTitle:(NSString *)cancelTitle doneTitle:(NSString *)doneTitle viewController:(UIViewController *)viewController block:(AlertBlock)block {
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *cancel = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *cancelAction) {
        
    }];
    
    UIAlertAction *ok = [UIAlertAction actionWithTitle:doneTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *okAction) {
        block(block);
    }];
    
    [alert addAction:cancel];
    [alert addAction:ok];
    
    [viewController presentViewController:alert animated:YES completion:^{
        
    }];

}

+ (void)createAlertSheetTitle:(NSString *)alertTitle alertMessage:(NSString *)alertMessage cancelTitle:(NSString *)cancelTitle doneTitle:(NSString *)doneTitle viewController:(UIViewController *)viewController block:(AlertBlock)block {
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction *cancel = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *cancelAction) {
        
    }];
    
    UIAlertAction *ok = [UIAlertAction actionWithTitle:doneTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *okAction) {
        block(block);
    }];
    
    [alert addAction:cancel];
    [alert addAction:ok];
    
    [viewController presentViewController:alert animated:YES completion:^{
        
    }];
    
}

@end
